import type { INoticeList, IOneNotice, IPublicNotice } from '@/types/notice'
import type { IPage } from '@/types/table'
import { request } from '@/utils/request'

/**
 * 获取公告列表
 * @param data 
 * @returns 
 */
export const getNoticesList = (data: IPage) =>
    request<INoticeList>('/notice','get',data)


/**
 * 发布公告
 * @param data 
 * @returns 
 */
export const publicNotice = (data: IPublicNotice) => 
    request<string>('/notice','post',data)

/**
 * 编辑公告
 * @param data 
 * @returns 
 */
export const editNotice = (id:number,data: IPublicNotice) => 
    request<string>('/notice/'+id,'patch',data)

/**
 * 根据ID获取公告
 * @param data 
 * @returns 
 */
export const getNotices = (id:number) =>
    request<IOneNotice>('/notice/'+id,'get')

/**
 * 根据ID删除公告
 * @param data 
 * @returns 
 */
export const delNotices = (id:number) =>
    request<string>('/notice/'+id,'delete')



